Ext.onReady(function(){
	    Ext.QuickTips.init();	//初始化Ext.QuickTips，以使得tip提示可用
		var loginForm = new Ext.form.FormPanel({
			clientValidation:true,	//客户端验证
			renderTo:'loginForm',
			title:'用户登陆',
			labelWidth:50,
			height:150,
			width:350,
			frame:true,			//此窗口panel具有全部阴影
			labelSeparator:':',
			labelAlign:'left',
			items:[
					new Ext.form.TextField({
						fieldLabel:'用户名',
						name:'j_username',
						inputType:'text',
						width:150,
						allowBlank:false,
						blankText:'请输入',
						value:'shujie'
						
					}),
					
					new Ext.form.TextField({
						fieldLabel:'密码',
						name:'j_password',
						inputType:'password',
						width:150,
						allowBlank:false,
						blankText:'请输入',
						value:'shj'
						
}) 
				/* new Ext.form.TextField({
					fieldLabel:'用户名',
					name:'userinfo.loginname',
					inputType:'text',
					width:150,
					allowBlank:false,
					blankText:'请输入',
					value:'shujie'
					
				}),
			
				new Ext.form.TextField({
					fieldLabel:'密码',
					name:'userinfo.password',
					inputType:'password',
					width:150,
					allowBlank:false,
					blankText:'请输入',
					value:'shj'
					
				}) */
			],
			buttons:[
				new Ext.Button({
					text:'登陆',
					handler:login
				}),
				new Ext.Button({
					text:'重置',
					handler:reset
				})
			]
		 
		})
		
		function login(){
          
			loginForm.form.submit({
				clientValidation:true,
				waitTitle:'提示',
				waitMsg:'正在登录系统请稍后',
				url:'login.action',
				//url:'login.action',
				method:'POST',
			//	 success: function(response,options){Ext.MessageBox.alert(' 提示',Ext.decode(response.responseText).msg);},
			///	 failure: function(response,options){Ext.MessageBox.alert('提示','Ext.decode(response.responseText).msg);},
				success : function(response, action) {
			    	var flag=action.result.data.msg;
			    	Ext.Msg.alert('提示', flag);
			    	document.location="page/main.jsp";
			    },
		     	failure : function(form,action) {
					var flag=action.result.data.msg;
				    Ext.Msg.alert('提示', flag);
				}
			})
		}
		
		function reset(){
			loginForm.form.reset();
		}
	});